<template>
	<section>
		<!--工具条-->

		<el-row class="toolbar" style="padding-bottom: 0px;" type="flex" size='medium'>
			<el-col :span="12"  size='medium'>
							<el-select placeholder="选择画室" v-model="forms.studioName">
								<el-option v-for="studio in studios"
										:key="studio.studioName"
										:value="studio.studioName">
								</el-option>
							</el-select>
            <el-button type="primary" v-on:click="getUsers" size='medium'>查询</el-button>
      </el-col>
      <el-col :span="12"  size='medium' >
        <div style="float:right">
            <el-button type="primary" v-on:click="getUsers" size='medium'>导出成绩单</el-button>
						<el-button type="primary" v-on:click="getUsers" size='medium'>导出作品集</el-button>
        </div>
			</el-col>
			
		</el-row>
		<div class='collections' >
      <div style="width:150px;height:180px;background-color:#fff;margin:10px 10px;flex-wrap:wrap" v-for='(studio,idx) in studios' :key='idx'>
        <el-image
      style="width: 140px; height: 140px:margin:auto"
      :src="imagefolderurl"
      ></el-image>
      <div style="margin:auto;text-align: center;font-size:18px">
        {{studio.studioName}}
      </div>
       <div style="margin:auto;text-align: center">
        3个文件夹
      </div>
      </div>
    </div>
		

		<!--工具条-->
		<el-col :span="24" class="toolbar">
			<el-pagination layout="prev, pager, next" @current-change="handleCurrentChange" :page-size="20" :total="total" >
			</el-pagination>
		</el-col>

			<!--新增界面-->
		<el-dialog title="上传试卷" :visible.sync="addFormVisible" :close-on-click-modal="false" class="dialog1" >
			<exampaperUploader ></exampaperUploader>
		</el-dialog>

	
	</section>
</template>

<script>

	import provinceCodeList from "../../utils/provinceCode";
	import gradeCodeList from "../../utils/gradeCode";
	import axios from 'axios'
	import {score_queryScore,getStudioList} from '../../api/api';
	export default {
		components:{},
		data() {
			return {
        imagefolderurl:'/static/assets/icon/collectionFolder.png',
				studios:[],
				provinceList: provinceCodeList,
				gradeList:gradeCodeList,
				userModifyVisible:false,
				userAddVisible: false,//编辑界面是否显示
				forms:{
					size:10,
					current:1,
					province:'',
					studioName:'',
				},
				transRow:{},
				exampaper:[],
				users: [],
				total: 0,
				page: 1,
				listLoading: false,
				sels: [],//列表选中列
				hasCourses:[{lable:'素描'},{lable:'上海'},{lable:'浙江'}],
				hasProvinces:[{lable:'北京'},{lable:'上海'},{lable:'浙江'}],
				editLoading: false,
			}
		},
		methods: {

			handleCurrentChange(val) {
				this.page = val;
				this.getUsers();
			},
			//获取用户列表
			getUsers() {
				this.listLoading = true;
				score_queryScore(this.forms).then((res) => {
					console.log(res)
					this.total = res.result.total;
					this.users = res.result;
					this.listLoading = false;
				});
			},
			//删除
			handleQuery: function (index, row) {
				this.$store.state.studio.name=row.studioname
				this.$store.state.studio.studentsCount=row.studentsCount
				this.$router.push({path: '/studioDetail'})
			},
			//显示编辑
			handleAdd: function () {
				this.userAddVisible = true;
			},
			//显示编辑
			handleEdit: function (idx,row) {
				this.transRow=row
				this.transRow['provinces']=row.province.split(',')
				console.log(this.transRow['provinces'])
				this.userModifyVisible = true;
			},
			handleStates:function (idx,row){
				this.transRow=row
				this.transRow['provinces']=row.province.split(',')
				this.transRow.enable=!this.transRow.enable
				user_info_update(this.transRow).then((res)=>{
					console.log(res)
				})

			},
			selsChange: function (sels) {
				this.sels = sels;
			},
		},
		mounted() {
			axios.defaults.headers.common["Art-Token"] = sessionStorage.getItem('Art-Token');
			getStudioList().then((res)=>{this.studios=res})
			this.exampaper=this.$store.state.exampaper
			this.getUsers();
		}
	}

</script>

<style>
.collections{
  display: inline-flex;
  width:100%;
  height:600px;
  background-color:#fff;
  flex-wrap:wrap;
  justify-content:flex-start;
  align-content: flex-start
}
.el-button--small{
	padding: 1px 1px;
}
.el-dialog__header{
	text-align: center;
}
.el-dialog__title{
	font-size: 32px;
}
</style>